--初始主场景


local MainScene = class("MainScene", cc.load("mvc").ViewBase)

local function createStaticButton(node, imageName, x, y, callback)    
    --local playButton = cc.MenuItemImage:create(imageName, imageName)
        --:onClicked(callback)
    cc.Menu:create(cc.MenuItemImage:create(imageName, imageName)
        :onClicked(callback))
        :move(x, y)
        :addTo(node)
end

function MainScene:onCreate()
    -- add background image
    display.newSprite("bg.jpg")
        :move(display.center)
        :addTo(self)

    -- add play button
    createStaticButton(self, "button_start.png", display.cx, display.cy - 150, function ( )
        print("onClicked start")
        self:getApp():enterScene("PlayScene")
    end)  
    createStaticButton(self, "button_exit.png", display.cx, display.cy - 250, function ( )
        print("onClicked exit")
    end) 
    createStaticButton(self, "button_shezhi.png", display.cx / 2 + 350, display.cy - 250, function ( )
        print("进入编辑场景")
        self:getApp():enterScene("EditorScene")
    end) 
    createStaticButton(self, "button_wenti.png", display.cx / 2 + 130, display.cy - 250, function ( )
        print("onClicked wenti")
    end)    
end

return MainScene
